Robotics 1.0 Lesson Plan
Lesson 19: Magic Slider

Purpose: Demonstrate how a pressure sensor and limit switches can be used with a servo driven rack and pinion to simulate an automatic sliding door mechanism.

No. of. Classes

1 - (Time : 1:30 minutes, each group maximum 4 children).

Materials Required

Desktop or laptop computer, CPX board, Crickit, USB cable, 5V battery

MG995 servo motor

Pressure sensor

Jumper wires

2 limit switches

Prior knowledge

Basic understanding of the CPX and Crickit boards
How servo motors move and are controlled
How digital sensors work
How to upload CircuitPython code using the Mu Editor.

Exercises

Exercise:1



FSR

Learning how a pressure sensor works


  • Connect a pressure sensor to the Crickit using the connection diagram
  • Test the working of the pressure sensor using the sample code in this document


  • Exercise:2



    Using the pressure sensor to create an automatic sliding door mechanism


  • View this video to learn how to add the pressure sensor component to our sliding door
  • Implement the logic in pseudocode to create the automatic sliding door when pressure sensor is triggered
  • Solution



  • Click here to see the solution video for Exercise 2.
  • Click here to see the code for Exercise 2.
  • Click here to see the code explanation for Exercise 2.
  • Teacher's Instruction
    1. Explain the goal of the activity, which is to make the door open when pressure is applied.
    2. Explain how the pressure sensor detects when someone presses on the door.
    3. Demonstrate how the program continuously checks the pressure sensor value.
    4. Show how pressing the sensor causes the door to open or reverse for safety.
    5. Explain the working of the pressure sensor (Force Sensitive Resistor or FSR). Use a multimeter to show the change in resistance reading for the FSR when varying levels of force is applied and when no force is applied
    6. Demonstrate the CircuitPython code that uses the pressure sensor to control movement.
    7. Guide students through testing different amounts of pressure and observing the door’s response.
    8. In our program we are using digital_read for the FSR, but could we instead use analog_read to get more detailed pressure values? Why or Why not? If yes, how would that change the way the door responds to different amounts of force?